package com.segersten.othello.service.rest;

import java.util.concurrent.atomic.AtomicBoolean;

public class AkkaServerStartupWait {

	static AtomicBoolean called = new AtomicBoolean(false);

	public static void start() {

		synchronized (called) {
			if (called.getAndSet(true)) {
				System.out.println("Waiting for server to start (2 secs) ");
				for (int i = 0; i < 4; i++) {
					try {
						Thread.currentThread().sleep(500);
					} catch (InterruptedException e) {
						throw new RuntimeException(e);
					}
					System.out.print(".");
				}
			}
		}
	}
}
